import { FormProps, BasicColumn } from '@/components/Table';

export function getBasicColumns(): BasicColumn[] {
  const go = useGo();
  return [
    {
      title: '姓名',
      dataIndex: 'userName',
      width: 200,
      customRender: ({ text, record }) => (
        <span
          onClick={() => {
            go({
              name: 'UserInfo',
              query: {
                id: record.id,
              },
            });
          }}
          class="text-primary hover:underline"
        >
          {text}
        </span>
      ),
    },
    {
      title: '手机号',
      dataIndex: 'phone',
      width: 150,
    },
    {
      title: '已上课程',
      dataIndex: 'address',
    },
    {
      title: '课程偏好',
      dataIndex: 'no',
    },
    {
      title: '问卷信息',
      dataIndex: 'info',
      // slots: { default: 'info' },
    },
    {
      title: '状态',
      dataIndex: 'beginTime',
    },
  ];
}

export function getFormConfig(): Partial<FormProps> {
  return {
    labelWidth: 100,
    baseColProps: {
      span: 8,
    },
    schemas: [
      {
        field: `userName`,
        label: `用户姓名`,
        component: 'AInput',
      },
      {
        field: `phone`,
        label: `手机号`,
        component: 'AInput',
      },
    ],
  };
}
export function getBasicData() {
  return (() => {
    const arr: any = [];
    for (let index = 0; index < 40; index++) {
      arr.push({
        id: `${index}`,
        userName: 'John Brown',
        phone: `180${index}`,
        age: `1${index}`,
        no: `${index + 10}`,
        address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park',
        info: 'fdfdsfdfd',
        beginTime: new Date().toLocaleString(),
        endTime: new Date().toLocaleString(),
      });
    }
    return arr;
  })();
}
